<?php
$this->beginWidget('bootstrap.widgets.TbBox', array(
	'title' => array($this->projectName => array('project/schema'), '搜索日志管理'),
	'headerIcon' => 'icon-map-marker',
));
?>
<div class="row-fluid row-top">
	<div class="span8 input-append">
		<?php
		echo CHtml::beginForm(array($this->route), 'get', array('class' => 'search form-inline'));
		$this->widget('zii.widgets.jui.CJuiAutoComplete', array(
			'name' => 'q',
			'value' => $q,
			'sourceUrl' => array('project/suggest'),
			'options' => array(
				'minLength' => '1',
				'select' => 'js:function(ev,ui){$(\'form.search input.span10\').val(ui.item.label);$(\'form.search\').submit();}',
			),
			'htmlOptions' => array(
				'class' => 'span10',
				'maxlength' => '80',
				'placeholder' => '请输入关键词...',
			),
		));
		$this->widget('bootstrap.widgets.TbButton', array(
			'type' => 'primary',
			'buttonType' => 'submit',
			'label' => '搜索',
		));
		echo CHtml::endForm();
		?>
	</div>
	<div class="span4 text-right">
		<?php
		$this->widget('bootstrap.widgets.TbButton', array(
			'type' => 'normal',
			'label' => '添加新词到搜索日志中',
			'url' => array('project/logAdd'),
		));	
		?>
	</div>
</div>
<?php
$this->widget('bootstrap.widgets.TbGridView', array(
	'type' => 'striped bordered condensed',
	'dataProvider' => $gridDataProvider,
	'rowCssClassExpression' => '$data->isRemoved?"removed":""',
	'template' => "{items} {pager}",
	'columns' => array(
		array(
			'name' => 'body',
			'header' => '搜索词',
		),
		array(
			'name' => 'total',
			'header' => '次数',
		),
		array(
			'class' => 'bootstrap.widgets.TbButtonColumn',
			'template' => '{delete}',
			'deleteButtonUrl' => 'array("project/logDelete","body"=>$data->body)',
		),
	),
));
$this->endWidget();
